{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f65e2fbc-0bf6-4284-9141-6bb18ab5add7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-12-09T15:01:37.901339Z",
     "iopub.status.busy": "2024-12-09T15:01:37.900698Z",
     "iopub.status.idle": "2024-12-09T15:01:37.919635Z",
     "shell.execute_reply": "2024-12-09T15:01:37.917865Z",
     "shell.execute_reply.started": "2024-12-09T15:01:37.901291Z"
    }
   },
   "outputs": [],
   "source": [
    "from IPython.display import Image"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "dc33b224-8a35-46cf-9f11-bac50ed92def",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-12-09T15:01:39.151916Z",
     "iopub.status.busy": "2024-12-09T15:01:39.151360Z",
     "iopub.status.idle": "2024-12-09T15:01:39.169286Z",
     "shell.execute_reply": "2024-12-09T15:01:39.167225Z",
     "shell.execute_reply.started": "2024-12-09T15:01:39.151872Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<img src=\"../imgs/tab.jpeg\" width=\"500\"/>"
      ],
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image(url='../imgs/tab.jpeg', width=500)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7b0f672f-c703-4ee1-81bf-a8887876946c",
   "metadata": {},
   "source": [
    "### 如何基于 cursor 从 0-1 实现项目开发（1013）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7f0d8f55-6e68-490a-993d-9b88e48c2e5c",
   "metadata": {},
   "source": [
    "- 创建文件夹先写一个 pipeline.md 的文件；\n",
    "    - 在这个文件中用自然语言写整个项目的目标，及开发上的模块和流程；\n",
    "    - 思路必须清晰，考验架构、抽象及模块化的能力；"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85d71a79-0874-45c9-96e1-8267b6a3337d",
   "metadata": {},
   "source": [
    "## cursor vs. (github) copilot"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "12a814a7-6bd9-4734-b606-6703758745ae",
   "metadata": {},
   "source": [
    "> Claude 3.5 sonnect 卓越的代码能力的加持下，使得 Cursor 的代码能力得到显著地飞升；\n",
    "\n",
    "- 传统的补全\n",
    "    - words 匹配\n",
    "- copilot 只是一个高级的代码补全\n",
    "    - vscode等其他的 plugin\n",
    "    - 局部的自动高级补全，基于代码语义\n",
    "    - 只做补全，接下文；\n",
    "- cursor：AI-first code editor\n",
    "    - features\n",
    "        - https://www.cursor.com/features\n",
    "    - 本身就是一个 app （AI-powered IDE），real 结对编程\n",
    "    - 继承了 vscode（无缝迁移 vscode 的插件）\n",
    "        - 继承自 vscode 的快捷键\n",
    "            - ctrl + shift + o：当前文件中定位 symbol\n",
    "            - ctrl + t：跨文件定位 symbol\n",
    "            - ctrl + p：基于文件名搜索文件\n",
    "    - 更全局（global）的 context window\n",
    "        - context of the entire project\n",
    "    - 不只是尾部做提示补全，还可在内部做提示，还可做修改；\n",
    "    - chat tab 支持图片输入；\n",
    "        - 不需要图片文件，截图的拷贝，右键的拷贝，都可以直接粘贴进对话框中；\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8189c517-5167-4f45-9712-0462c7732a3b",
   "metadata": {},
   "source": [
    "### ctrl + k, ctrl + l"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d0f2d5ab-ad3a-4b9a-94fb-4c7e65ea948c",
   "metadata": {},
   "source": [
    "- ctrl + l：chat 模式下生成的 code snippets 可以直接 apply\n",
    "    - tab tab ..."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a920786e-b432-4fe2-b93e-a9bc1b1b3417",
   "metadata": {},
   "source": [
    "### prompts"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f201c290-4379-4e94-8c9b-f5c6c8f90b42",
   "metadata": {},
   "source": [
    "- 对话框中\n",
    "    - 复制当前文件中的一段代码，\n",
    "        - 解释这段代码；\n",
    "        - 重构这段代码；\n",
    "- code editor 基于注释的自动补全：自然语言编程；\n",
    "    - 先写注释\n",
    "    - 换行，让其自动补全；\n",
    "- RAG\n",
    "    - 读 api 文档（官方 doc），基于 api 或者官方 doc 写代码"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "65a84e5e-c9b1-42dd-aff5-b6cc3c52d5f8",
   "metadata": {},
   "source": [
    "### terminal"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "afc96c7c-d335-4081-935d-fae896eaf99f",
   "metadata": {},
   "source": [
    "- 输入时\n",
    "    - ⌘ + k：generate a command\n",
    "    - ⌘ + /：autocomplete\n",
    "- 执行命令时\n",
    "    - 自动提取错误到右侧的 chat 对话框；\n",
    "    - Please help me debug this code."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cf0955da-f01c-4ead-94c2-b52d87b54786",
   "metadata": {},
   "source": [
    "### 3.5 sonnect artifact"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "af9e612e-b4cc-4da8-bf00-3920a0bd905e",
   "metadata": {},
   "source": [
    "\n",
    "- 基于 Mermaid 画流程图（而且是 svg），太秒了；\n",
    "    - 后续可以基于此，也即是将一些复杂逻辑的代码丢进去，让其先画流程图出来，很好/很快地去理解和消化复杂的代码逻辑；"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
